package com.lan.extend.dict.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 获取spring配置文件的参数
 */
@Component
@ConfigurationProperties(prefix = "lan.dict.cache")
public class CacheProperties {

    /** 是否开启缓存，全局开关，不开启的话@LanDictData里的开关不会生效 */
    private boolean enabled = true;

    /** 刷新时间，单位秒 */
    private long refreshTime = 30;

    /** 懒加载，默认开启 */
    private boolean lazyLoad = true;

    /** 缓存键值名称 */
    private String dictKeyName = "lan_dict_key";

    public boolean getEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public long getRefreshTime() {
        return refreshTime;
    }

    public boolean isEnabled() {
        return enabled;
    }

    public void setRefreshTime(long refreshTime) {
        this.refreshTime = refreshTime;
    }

    public boolean isLazyLoad() {
        return lazyLoad;
    }

    public void setLazyLoad(boolean lazyLoad) {
        this.lazyLoad = lazyLoad;
    }

    public String getDictKeyName() {
        return dictKeyName;
    }

    public void setDictKeyName(String dictKeyName) {
        this.dictKeyName = dictKeyName;
    }
}
